﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace OpenPhotoAlbum.Maintainance
{
	public partial class Albums : AlbumPage
	{
		protected override void OnInit(EventArgs e)
		{
			base.OnInit(e);

			gridView.RowCommand += new GridViewCommandEventHandler(gridView_RowCommand);
		}

		protected void gridView_RowCommand(object sender, GridViewCommandEventArgs e)
		{
			if (e.CommandName == "Recommend")
			{
				Guid albumId = (Guid)gridView.DataKeys[int.Parse((string)e.CommandArgument)].Value;
				BusinessLogics.AlbumManager.Instance.SetUnsetRecommendation(albumId);
				gridView.DataBind();
			}
		}

		protected override void AppendSiteMapNodes(OpenPhotoAlbum.Controls.AlbumSiteMapProvider provider)
		{
			base.AppendSiteMapNodes(provider);

			provider.AppendSiteMapNode("Maintainance Console", "~/Maintainance/Default.aspx");
			provider.AppendSiteMapNode("Latest Created Albums", RawUrl);
		}
	}
}
